package com.houdoudou.com.jooq;

import org.jooq.util.GenerationTool;
import org.jooq.util.jaxb.Configuration;
import org.jooq.util.jaxb.Database;
import org.jooq.util.jaxb.Generator;
import org.jooq.util.jaxb.Jdbc;
import org.jooq.util.jaxb.Target;

/**
 * JooqGenerator
 *
 * @author Cassius Cai
 * @version v 0.1 8/1/15 23:17 Exp $
 */
public class JooqGenerator {

    public static void main(String[] args) throws Exception {

        Configuration configuration = new Configuration()
            .withJdbc(
                new Jdbc().withDriver(com.mysql.jdbc.Driver.class.getName())
                    .withUrl("jdbc:mysql://localhost:3306/houdou")
                    .withUser(
                        "root")
                    .withPassword(""))
            .withGenerator(new Generator().withName("org.jooq.util.DefaultGenerator")
                .withDatabase(
                    new Database().withName(org.jooq.util.mysql.MySQLDatabase.class.getName())
                        .withIncludes(".*").withExcludes("").withInputSchema("houdou"))
                .withTarget(new Target().withPackageName("com.houdoudou.com.jooq.database")
                    .withDirectory("src")));
        GenerationTool.generate(configuration);
    }
}
